<template>
  <div>
    <el-row style="margin-bottom: 20px">
      <el-button type="primary" size="small"  @click="dialogFormVisible = true">新增</el-button>
    </el-row>
    <el-row>
      <el-col>
        <el-table
          :data="tableData"
          style="width: 100%"
          border>
          <el-table-column
            prop="date"
            align="center"
            label="日期">
          </el-table-column>
          <el-table-column
            prop="name"
            align="center"
            label="课程名称">
          </el-table-column>
          <el-table-column
            prop="province"
            align="center"
            label="所在实训室">
          </el-table-column>
          <el-table-column
            prop="city"
            align="center"
            label="面向专业">
          </el-table-column>
          <el-table-column
            prop="address"
            align="center"
            label="班级">
          </el-table-column>
          <el-table-column
            prop="zip"
            align="center"
            label="实训手册">
          </el-table-column>
          <el-table-column
            align="center"
            label="操作">
            <template slot-scope="scope">
              <el-button @click="handleClick(scope.row)" type="text" size="small">查看</el-button>
              <el-button @click="handleClick(scope.row)" type="text" size="small">编辑</el-button>
              <el-button @click="handleClick(scope.row)" type="text" size="small">下载手册</el-button>
            </template>
          </el-table-column>
        </el-table>
        <el-pagination
          background
          style="margin-top: 10px;text-align: right"
          layout="prev, pager, next"
          :total="1000">
        </el-pagination>
      </el-col>
    </el-row>
    <el-dialog title="新增课程" :visible.sync="dialogFormVisible">
      <el-form :model="form">
        <el-row>
          <el-col :span="12">
            <el-form-item label="课程名称" :label-width="formLabelWidth">
              <el-input v-model="form.name" autocomplete="off"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="日期" :label-width="formLabelWidth">
              <el-col>
                <el-date-picker type="date" placeholder="选择日期" v-model="form.date1" style="width: 100%;"></el-date-picker>
              </el-col>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="所在实训室" :label-width="formLabelWidth">
              <el-input v-model="form.name" autocomplete="off"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="面向专业" :label-width="formLabelWidth">
              <el-select clearable v-model="form.region" placeholder="请选择专业" style="width: 100%">
                <el-option label="专业一" value="shanghai"></el-option>
                <el-option label="专业二" value="beijing"></el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="班级" :label-width="formLabelWidth" >
              <el-select clearable v-model="form.region" placeholder="请选择班级" style="width: 100%">
                <el-option label="班级一" value="shanghai"></el-option>
                <el-option label="班级二" value="beijing"></el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-form-item label="实训手册" :label-width="formLabelWidth">
          <el-upload
            class="upload-demo"
            drag
            action="https://jsonplaceholder.typicode.com/posts/"
            multiple>
            <i class="el-icon-upload"></i>
            <div class="el-upload__text">将文件拖到此处，或<em>点击上传</em></div>
            <!--<div class="el-upload__tip" slot="tip">只能上传jpg/png文件，且不超过500kb</div>-->
          </el-upload>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="dialogFormVisible = false">取 消</el-button>
        <el-button type="primary" @click="dialogFormVisible = false">确 定</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
  export default {
    name: "CurriculumProvision",
    data() {
      return {
        tableData: [{
          date: '2016-05-02',
          name: '王小虎',
          province: '陕西',
          city: '计算机科学与应用',
          address: '陕西省西安市',
          zip: 200333
        }, {
          date: '2016-05-04',
          name: '王小虎',
          province: '陕西',
          city: '计算机科学与应用',
          address: '陕西省西安市',
          zip: 200333
        }, {
          date: '2016-05-01',
          name: '王小虎',
          province: '陕西',
          city: '计算机科学与应用',
          address: '陕西省西安市',
          zip: 200333
        }, {
          date: '2016-05-03',
          name: '王小虎',
          province: '陕西',
          city: '计算机科学与应用',
          address: '陕西省西安市',
          zip: 200333
        }],
        dialogFormVisible: false,
        form: {
          name: '',
          region: '',
          date1: '',
          date2: '',
          delivery: false,
          type: [],
          resource: '',
          desc: ''
        },
        formLabelWidth: '120px'
      }
    },
    methods: {
      handleClick(row) {
        console.log(row);
        this.dialogFormVisible = true
      }
    },
  }
</script>

<style scoped>

</style>
